﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using G.WeiBo.WebAPI.Domain;
using G.WeiBo.WebAPI.Response;
using G.WeiBo.WebAPI.Request;
using G.Navigate;

namespace G.WeiBo.Command
{
    public class DeleteMessageCommand:BaseCommand
    {


        public override bool CanExecute(object parameter)
        {
            return true;
        }

        public override void Execute(object parameter)
        {
            Message messag = parameter as Message;
            GlobalStaticData.Client.Execute(new DeleteMessageRequest { ID = messag.Id, }, (c) =>
            {
                if (!c.IsError)
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        PhoneApplicationPageHelp.ShowState("删除成功!");
                    });
                }
            });
        }
    }
}
